package com.bbz.core.set;
/**
 * 重写不同对象的HashCode，让其相等 
 * @author binbin.a.zhang
 *
 */

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

public class ObjectDemo {

	public static void main(String[] args) {
		Name n1 = new Name("01");
		Name n2 = new Name("02");

		Collection c = new HashSet();
		c.add(n1);
		System.out.println("------------");
		c.add(n2);
		System.out.println("------------");
		System.out.println(n1.equals(n2));
		System.out.println("------------");
		System.out.println(n1.hashCode());
		System.out.println(n2.hashCode());
		System.out.println(c);
	}

}
